<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD Xhtml 1.0 Transitional//EN" "http://www.w3.org/tr/xhtml1/Dtd/xhtml1-transitional.dtd">
<!--
 *************************************************************************
 * The contents of this file are subject to the Openbravo  Public  License
 * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
 * Version 1.1  with a permitted attribution clause; you may not  use this
 * file except in compliance with the License. You  may  obtain  a copy of
 * the License at http://www.openbravo.com/legal/license.html 
 * Software distributed under the License  is  distributed  on  an "AS IS"
 * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
 * License for the specific  language  governing  rights  and  limitations
 * under the License. 
 * The Original Code is Openbravo ERP. 
 * The Initial Developer of the Original Code is Openbravo SLU 
 * All portions are Copyright (C) 2008-2012 Openbravo SLU 
 * All Rights Reserved. 
 * Contributor(s):  ______________________________________.
 ************************************************************************
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Module Management</title>

<link rel="shortcut icon" href="../../../../../web/images/favicon.ico" type="image/x-icon" />
<link rel="stylesheet" type="text/css" href="../../../../../web/skins/Default/Openbravo_ERP_250.css" id="paramCSS"/> 
<script language="JavaScript" type="text/javascript" id="paramDirectory">
var baseDirectory = "../../../../../web/";
</script> 
<script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
<script language="JavaScript" type="text/javascript" id="paramLanguage">
  var defaultLang = "en_US";
</script>
<script language="JavaScript" src="../../../../../web/js/shortcuts.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/utils.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/windowKeyboard.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/ajax.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/default/MessageBox.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/messages.js" type="text/javascript"></script>
<script language="JavaScript" src="../utility/DynamicJS.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/appStatus.js" type="text/javascript"></script>
<script language="JavaScript" src="../../../../../web/js/genericTree.js" type="text/javascript"></script>
  

<script language="JavaScript" type="text/javascript">
  
  var OB = OB || {};
  OB.GenericTree = OB.GenericTree || {};
  OB.GenericTree.doNotUpdateTreeInfo = false;

  function validate(action, form, value) {
    return true;
  }
  
  function onloadFunctions() {
  }
  

</script>
  <script language="JavaScript" type="text/javascript">
  function onLoadDo(){
    this.windowTables = new Array(
      new windowTableId('client', 'buttonScan')
    );
    setWindowTableParentElement();
    this.tabsTables = new Array(
      new tabTableId('tdtopTabs')
    );
    setTabTableParentElement();
    enableShortcuts('edition');
    setWindowElementFocus('firstElement');
    setBrowserAutoComplete(false);
    
    try {
      onloadFunctions();
    } catch (e) {}

    if (document.getElementById('notifications').innerHTML == "") {
      changeClass('notifications', 'Tree_Actions_Invisible', 'Tree_Actions');
    } 
    gt_setActiveUninstall('buttonUninstall');
    gt_setActiveUninstall('buttonDisable');

    resizeArea();
    gt_adjustTreeWidth();

    // disable the core module checkbox (core module can't be disabled or uninstalled)
    document.getElementById("inpNodes_0").disabled=true;
  }

  function onResizeDo(){
    resizeArea();
  }
  
  function scan_callback(paramXMLParticular, XMLHttpRequestObj) {
    var i, j, treeItems, jsonResponse, treeItemChildren, up;
    if (getReadyStateHandler(XMLHttpRequestObj)) {
      try {
        if (XMLHttpRequestObj.responseText) {
          jsonResponse = eval("(" + XMLHttpRequestObj.responseText + ")");

          // revert all tree item icons to default state
          var treeItems = getElementsByClassName('Tree_Row');
          for (i=1;i<treeItems.length;i++) {
              treeItemChildren = treeItems[i].childNodes;

              for (j=1;j<treeItemChildren.length;j++) {
                  if (treeItemChildren[j].id === 'icon' && treeItemChildren[j].childNodes[1]) {
                      treeItemChildren[j].childNodes[1].setAttribute("class","");
                  }
              }
          }
          
          document.getElementById('notifications').innerHTML = jsonResponse.updatesRebuildHTML || "";
          
          // Set updates in the tree
          if (jsonResponse.updates) {
            for (up in jsonResponse.updates) {
              if (jsonResponse.updates.hasOwnProperty(up)) {
                var icon = document.getElementById("icon2_" + up),
                    link = document.getElementById("link_" + up);
                if (icon) {
                  icon.className="Tree_Icon_Update";
                }
                if (link && jsonResponse.updates[up]==="U") {
                  link.innerHTML = "Update Available"; //TODO: set proper language  
                  link.setAttribute("onclick", "gt_getUpdateDescription(event,'"+up+"');");
                }
              }
            }
          }
          
          
          // Remove upgrades to regenerate them
          var upgradeList = document.getElementById('upgradeList')
          if (upgradeList.hasChildNodes()){
            while (upgradeList.childNodes.length >= 1){
              upgradeList.removeChild(upgradeList.firstChild );       
            } 
          }
          
          // Generate upgrades
          if (jsonResponse.upgrades && jsonResponse.upgrades.length>0) {
            for (i=0; i<jsonResponse.upgrades.length; i++){
              var upgrNotif = document.createElement('p'), 
                  spMod = document.createElement('span'),
                  link = document.createElement('a');
              
              link.setAttribute('class', 'LabelLink_noicon');
              link.setAttribute('href', '#'); 
              link.setAttribute('onclick', 'installUpgrade("'+jsonResponse.upgrades[i].moduleId+'", "'+jsonResponse.upgrades[i].version+'"); return false;');
              link.appendChild(document.createTextNode('Install upgrade now')); //TODO: translatable
              
              upgrNotif.appendChild(spMod);
              upgrNotif.appendChild(link);
              
              
              upgradeList.appendChild(upgrNotif);
            }
            document.getElementById('upgrades').style.display = null;
          } else {
            document.getElementById('upgrades').style.display = 'none';
          }
          changeClass('notifications', 'Tree_Actions_Processing', 'Tree_Actions');
        }
      } catch (e) {
      }
    }
    return true;
  }
  
  function scanForUpdates(){
    if (document.getElementById('notifications').className.indexOf('Tree_Actions_Invisible') != -1) {
      changeClass('notifications', 'Tree_Actions_Invisible', 'Tree_Actions_Processing', true);
    } else {
      changeClass('notifications', 'Tree_Actions', 'Tree_Actions_Processing', true);
    }
    var paramXMLReq = null;
    return submitXmlHttpRequest(scan_callback, document.frmMain, "SCAN", "ModuleManagement.html", false, null, paramXMLReq);
  }
  
  function installUpdate(id){
    frmMain.inpcUpdate.value = id;
    openServletNewWindow('UPDATE', false, 'ModuleManagement.html', 'Update', null, true, 700, 900, null, null, null, null, true);
  }
  
  function installUpgrade(id, version) {
    frmMain.inpcUpdate.value = id;
    frmMain.upgradeVersion.value = version;
    openServletNewWindow('UPGRADE', false, 'ModuleManagement.html', 'Upgrade', null, true, 700, 900, null, null, null, null, true);
  }

  function uninstallModule(){
    if (showJSMessage(29)) {
      submitCommandForm('UNINSTALL', false, null, 'ModuleManagement.html', '_self', null, true);
    }
  }
  
  function disableModule(id){
    if (showJSMessage(31)) {
      submitCommandForm('DISABLE', false, null, 'ModuleManagement.html', '_self', null, true);
    }
  }

  function enableModule(id){
    // skip ajax call to refresh tree node info
    OB.GenericTree.doNotUpdateTreeInfo = true;

    if (showJSMessage(32)) {
     frmMain.inpcRecordId.value = id;  
     submitCommandForm('ENABLE', false, null, 'ModuleManagement.html', '_self', null, true);
    }
  }
  </script>
</head>
<body onload="onLoadDo();" onresize="onResizeDo();" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" id="paramMessage">
<form method="post" action="ModuleManagement.html" name="frmMain" >
  <input type="hidden" name="Command">
  <input type="hidden" name="IsPopUpCall" value="1"></input>
  <input type="hidden" name="inpcRecordId" id="inpcRecordId"></input>
  <input type="hidden" name="inpcUpdate" value="" id="inpcUpdate"></input>
  <input type="hidden" name="upgradeVersion" value="" id="upgradeVersion"></input>
  
  <table height="100%" border="0" cellpadding="0" cellspacing="0" id="main">
    <tr>
      <td valign="top" id="tdleftTabs"></td>
      <td valign="top">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Main_ContentPane_Left">
          <tr><td class="Main_NavBar_bg_left" id="tdleftSeparator"></td></tr>
          <tr><td class="Main_ToolBar_bg_left" valign="top"></td></tr>
          <tr><td class="Main_Client_bg_left"></td></tr>
          <tr><td class="Main_Bottom_bg_left"></td></tr>
        </table>
      </td>
      <td valign="top">
        <div class="Main_ContentPane_NavBar" id="tdtopButtons"></div>
        <div class="Main_ContentPane_ToolBar" id="paramToolBar"></div>
        
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Main_ContentPane_TabPane" id="tdtopTabs">
          <tr id="paramParentTabContainer"><td class="tabBackGroundInit">
            <div>
              <span class="tabTitle">
                <div class="tabTitle_background">
                  <span class="tabTitle_elements_container">
                    <span class="tabTitle_elements_text" id="tabTitle_text">Module Manager</span>
                    <span class="tabTitle_elements_separator"><div class="tabTitle_elements_separator_icon"></div></span>
                    <span class="tabTitle_elements_image"><div class="tabTitle_elements_image_normal_icon" id="TabStatusIcon"></div></span>
                  </span>
                </div>
              </span>
            </div>
            </td></tr><tr><td class="tabBackGround">  <div class="marginLeft">
            <div><span class="dojoTabNULL dojoTabparentfirst"></span>
              </div>
              </div>
            </td>
            </tr>
            <tr id="paramMainTabContainer">
              <td class="tabBackGround">
                <table class="tabTable">
                  <tr>
                    <td valign="top"><span class="tabLeft">&nbsp;</span></td>
                    <td class="tabPaneBackGround">
                    <div>
                      <span class="dojoTabcurrent"><div><span><a class="dojoTabLink" href="#" onclick="return false;" onMouseOver="return true;" onMouseOut="return true;" id="tabDefault">Installed Modules</a></span></div></span>
                      <span class="tabSeparator">&nbsp;</span>
                      <span class="dojoTab"><div><span><a class="dojoTabLink" href="#" onclick="submitCommandForm('ADD', false, null, 'ModuleManagement.html', '_self', null, true);return false;" onMouseOver="return true;" onMouseOut="return true;" id="tabInstall">Add Modules</a></span></div></span>
                      <span class="tabSeparator">&nbsp;</span>
                      <span class="dojoTab"><div><span><a class="dojoTabLink" href="#" onclick="submitCommandForm('HISTORY', false, null, 'ModuleManagement.html', '_self', null, true);return false;" onMouseOver="return true;" onMouseOut="return true;" id="tabHistory">Installation History</a></span></div></span>
                      <span class="tabSeparator">&nbsp;</span>
                      <span class="dojoTab"><div><span><a class="dojoTabLink" href="#" onclick="submitCommandForm('SETTINGS', false, null, 'ModuleManagement.html', '_self', null, true);return false;" onMouseOver="return true;" onMouseOut="return true;" id="tabSettings">Settings</a></span></div></span>
                    </div>
                    <td valign="top"><span class="tabRight">&nbsp;</span></td>
                  </tr>
                </table>
              </td>
            </tr>
        </table>
        
        
        
        <!-- TABLE width="100%" border="0" cellspacing="0" cellpadding="0" class="Main_ContentPane_TabPane" id="tdtopTabs">
          <tr id="paramParentTabContainer"></tr>
          <tr id="paramMainTabContainer"></tr>
          <tr id="paramChildTabContainer"></tr>
        </TABLE-->
        <div class="Main_ContentPane_Client" style="overflow: auto; display: none;" id="client">
                <table class="dojoTabContainer" border="0" cellpadding="0" cellspacing="0" width="100%" summary="">
                  <tr>
                    <td>
                      <table class="dojoTabPaneWrapper" border="0" cellpadding="0" cellspacing="0" width="100%" summary="">
                        <tr>
                          <td>
                            <!-- MessageBox -->

                            <table cellpadding="0" cellspacing="0" id="messageBoxID" class="MessageBoxyy">
                              <tbody>
                              <tr class="MessageBox_TopMargin">
                                <td class="MessageBox_LeftMargin"></td>
                                <td></td>
                                <td class="MessageBox_RightMargin"></td>
                              </tr>
                              <tr>
                                <td class="MessageBox_LeftMargin"></td>
                                <td>

                                  <table cellpadding="0" cellspacing="0" class="MessageBox_Container">
                                    <tbody>
                                    <tr>
                                      <td class="MessageBox_LeftTrans">
                                        <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
                                          <tbody>
                                          <tr>
                                            <td class="MessageBox_TopLeft"></td>
                                          </tr>
                                          <tr>
                                            <td class="MessageBox_Left"></td>
                                          </tr>
                                          </tbody>
                                        </table>
                                      </td>
                                      <td class="MessageBox_bg">

                                        <table class="MessageBox_Top">
                                        <tbody>
                                          <tr>
                                            <td>
                                              <span>
                                              <table cellpadding="0" cellspacing="0" class="MessageBox_Body_ContentCell">
                                                <tbody>
                                                <tr>
                                                  <td class="MessageBox_Icon_ContentCell">
                                                    <div class="MessageBox_Icon"></div>
                                                  </td>
                                                  <td style="vertical-align: top;" id="messageBoxIDContent">
                                                    <span>
                                                      <div class="MessageBox_TextTitle" id="messageBoxIDTitle">
                                                        xxInfo: AccessTableWithNoView
                                                      </div>
                                                      <div class="MessageBox_TextDescription" id="messageBoxIDMessage">
                                                        xxThe current information is empty.
                                                      </div>
                                                      <div class="MessageBox_TextSeparator"></div>
                                                    </span>
                                                  </td>
                                                </tr>
                                                </tbody>
                                              </table>
                                              </span>
                                            </td>
                                          </tr>
                                          </tbody>
                                        </table>

                                      </td>
                                      <td class="MessageBox_RightTrans">
                                        <table style="width: 100%; height: 100%" cellpadding="0" cellspacing="0">
                                          <tbody>
                                          <tr>
                                            <td class="MessageBox_TopRight"></td>
                                          </tr>
                                          <tr>
                                            <td class="MessageBox_Right"></td>
                                          </tr>
                                          </tbody>
                                        </table>
                                      </td>
                                    </tr>
                                    <tr>
                                      <td rowspan="2" class="MessageBox_BottomLeft">
                                      </td>
                                      <td class="MessageBox_BottomTrans MessageBox_bg">
                                      </td>
                                      <td rowspan="2" class="MessageBox_BottomRight">
                                      </td>
                                    </tr>
                                    <tr>
                                      <td class="MessageBox_Bottom">
                                      </td>
                                    </tr>
                                    </tbody>
                                  </table>

                                </td>
                                <td class="MessageBox_RightMargin"></td>
                              </tr>
                              <tr class="MessageBox_BottomMargin">
                                <td class="MessageBox_LeftMargin"></td>
                                <td></td>
                                <td class="MessageBox_RightMargin"></td>
                              </tr>
                              </tbody>
                            </table>              <!-- USER CONTROLS -->
              <table class="Main_Client_TableEdition">
                <tr>
                  <td class="TableEdition_OneCell_width"></td>
                  <td class="TableEdition_OneCell_width"></td>
                  <td class="TableEdition_OneCell_width"></td>
                  <td class="TableEdition_OneCell_width"></td>
                  <td class="TableEdition_OneCell_width"></td>
                  <td class="TableEdition_OneCell_width"></td>
                </tr>
                
                <tr>
                 <td class="Button_LeftAlign_ContentCell" colspan="2">
                    <div>
                      <button type="button" 
                        id="buttonScan" 
                        class="ButtonLink" 
                        onclick="scanForUpdates();return false;" 
                        onfocus="buttonEvent('onfocus', this); window.status='Scan for updates'; return true;" 
                        onblur="buttonEvent('onblur', this);" 
                        onkeyup="buttonEvent('onkeyup', this);" 
                        onkeydown="buttonEvent('onkeydown', this);" 
                        onkeypress="buttonEvent('onkeypress', this);" 
                        onmouseup="buttonEvent('onmouseup', this);" 
                        onmousedown="buttonEvent('onmousedown', this);" 
                        onmouseover="buttonEvent('onmouseover', this); window.status='Scan for updates'; return true;" 
                        onmouseout="buttonEvent('onmouseout', this);">
                        <table class="Button">
                          <tr>
                            <td class="Button_left"><img class="Button_Icon Button_Icon_scanUpdates" alt="Scan for updates" title="Scan for updates" src="../../../../../web/images/blank.gif" border="0" /></td>
                            <td class="Button_text">Scan for updates</td>
                            <td class="Button_right"></td>
                          </tr>
                        </table>
                      </button>
                    </div>
                  </td>
                  <td/>
                  <td/>
                  <td/>
                  <td/>
                </tr>
                <tr><td style="height: 10px;"></td></tr>
                
                <tr id="upgrades" style="display:none;">
                  <td colspan="4"> 
                    <div class="PlainText_normal Tree_Upgrade">
                      <p style="font-weight:normal;">A major upgrade is available:&nbsp;<b id="upgrName">xxcore</b></p>
                      <p style="font-weight:normal; font-size: 8pt;">
                      
                        <ul style="font-weight:normal; font-size: 8pt; margin: 5px; margin-left: 20px;">
                          <li>
                              An&nbsp;<b>upgrade</b>&nbsp;is the process to install a new major version of the product (eg. from version 2.50 to 3.0). 
                              Major versions include broad set of new features and usually require to train end users before deploying it into the production environment.
                          </li>
                          <li>
                              An&nbsp;<b>update</b>&nbsp;is the process to install a new minor version of the product (called Maintenance Pack, MP) or newer versions of other modules installed in the instance. 
                              Maintenance Packs usually include fixes to product defects or small enhancements and do not require end users to be trained.
                          </li>
                        </ul>
                      </p>
                      <div id="upgradeList">
                        <p><a id="upgrLink" href="#" onclick="installUpgrade('xx', 'yy'); return false;" class="LabelLink_noicon">Install upgrade now</a></p>
                      </div>
                      
                    </div>
                  </td>
                </tr>
                
                <tr><td style="height: 10px;"></td></tr>
                
                <tr>
                  <PARAMETER_TMP id="moduleTree"/> <!-- Prints module tree 4 cols -->
                  <td colspan="2" style="vertical-align: top;">
                    <table>
                      <tr><td style="height: 20px;"></td></tr>
                      <tr>
                        <td class="Button_LeftAlign_ContentCell" colspan="2">
                          <div>
                            <button type="button" 
                              id="buttonUninstall" 
                              class="ButtonLink" 
                              onclick="uninstallModule();return false;" 
                              onfocus="buttonEvent('onfocus', this); window.status='Uninstall selected'; return true;" 
                              onblur="buttonEvent('onblur', this);" 
                              onkeyup="buttonEvent('onkeyup', this);" 
                              onkeydown="buttonEvent('onkeydown', this);" 
                              onkeypress="buttonEvent('onkeypress', this);" 
                              onmouseup="buttonEvent('onmouseup', this);" 
                              onmousedown="buttonEvent('onmousedown', this);" 
                              onmouseover="buttonEvent('onmouseover', this); window.status='Uninstall selected'; return true;" 
                              onmouseout="buttonEvent('onmouseout', this);">
                              <table class="Button">
                                <tr>
                                  <td class="Button_left"><img class="Button_Icon" alt="Uninstall selected" title="Uninstall selected" src="../../../../../web/images/blank.gif" border="0" /></td>
                                  <td class="Button_text">Uninstall selected</td>
                                  <td class="Button_right"></td>
                                </tr>
                              </table>
                            </button>
                          </div>
                        </td>
                      </tr>
                      <tr>
                        <td class="Button_LeftAlign_ContentCell" colspan="2">
                          <div>
                            <button type="button" 
                              id="buttonDisable" 
                              class="ButtonLink" 
                              onclick="disableModule();return false;" 
                              onfocus="buttonEvent('onfocus', this); window.status='Disable selected'; return true;" 
                              onblur="buttonEvent('onblur', this);" 
                              onkeyup="buttonEvent('onkeyup', this);" 
                              onkeydown="buttonEvent('onkeydown', this);" 
                              onkeypress="buttonEvent('onkeypress', this);" 
                              onmouseup="buttonEvent('onmouseup', this);" 
                              onmousedown="buttonEvent('onmousedown', this);" 
                              onmouseover="buttonEvent('onmouseover', this); window.status='Disable selected'; return true;" 
                              onmouseout="buttonEvent('onmouseout', this);">
                              <table class="Button">
                                <tr>
                                  <td class="Button_left"><img class="Button_Icon" alt="Disable selected" title="Disable selected" src="../../../../../web/images/blank.gif" border="0" /></td>
                                  <td class="Button_text">Disable selected</td>
                                  <td class="Button_right"></td>
                                </tr>
                              </table>
                            </button>
                          </div>
                        </td>
                      </tr>
                    </table>
                  </td>
                <tr>
                <tr><td style="height: 5px;"></td></tr>
                <tr>
                  <PARAMETER_TMP id="moduleTreeDescription"/> <!-- Prints module tree 4 cols -->
                  <td/>
                  <td/>
                <tr>
              </table>
        


                      <!-- USER CONTROLS -->
                </td>
              </tr>
              </table>
              </td>
            </tr>
          </table>
        </div>

            

        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Menu_ContentPane_Bottom" id="tdbottomSeparator">
          <tr>
            <td class="Main_Bottom_bg"><img src="../../../../../web/images/blank.gif" border="0"></td>
          </tr>
        </table></td>
      <td valign="top">
        <table width="100%" border="0" cellspacing="0" cellpadding="0" class="Main_ContentPane_Right" id="tdrightSeparator">
          <tr><td class="Main_NavBar_bg_right"></td></tr>
          <tr><td class="Main_ToolBar_bg_right" valign="top"></td></tr>
          <tr><td class="Main_Client_bg_right"></td></tr>
          <tr><td class="Main_Bottom_bg_right"></td></tr>
        </table>
      </td>
    </tr>
  </table>
</form>

  
  
</body>
</html>
                          
               